package main

import (
	"context"

	"gitee.com/go-linux/logger"
	"golang.org/x/sync/errgroup"
)

// 序号
const (
	One = iota + 1
	Two
	Three
	Four
	Five
	Six
	Seven
	Eight
	Nine
)

// Position 魔方各个块的位置信息
type Position struct {
	X int
	Y int
	Z int
}

const (
	Null = iota
	PositiveTurn
	NegativeTurn
	PositiveTurnString = "顺时针旋转90度"
	NegativeTurnString = "逆时针旋转90度"
)

var TurnString = map[int]string{
	PositiveTurn: PositiveTurnString,
	NegativeTurn: NegativeTurnString,
}

type SerialNo struct {
	Wall  int // 面
	Block int // 块
}

type Info struct {
	list   map[SerialNo]Position
	group  *errgroup.Group
	exit   chan []Record
	ctx    context.Context
	cancel context.CancelFunc
	record []Record
	logs   logger.Log
}

type Record struct {
	Wall int
	Turn int
}

func (f *Info) Copy() *Info {
	var info = new(Info)
	info.ctx = f.ctx
	info.cancel = f.cancel
	info.group = f.group
	info.exit = f.exit
	info.record = make([]Record, 0)
	info.list = make(map[SerialNo]Position)
	info.logs = f.logs
	info.record = append(info.record, f.record...)
	for k, v := range f.list {
		info.list[k] = v
	}
	return info
}
